﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VMS.FTS.APPPUSH.Log
{     /*
    public abstract class ILogable
    {
        protected string LOG_TAG;
        protected void LOG(string message, LOG_LEVEL level)
        {
            Logger.Instance.append(LOG_TAG, message, level);
#if DEBUG
            LOG_LEVEL baseLevel = LOG_LEVEL.DEBUG;
            if (level > baseLevel)
            {
                if (level == LOG_LEVEL.ERROR)
                    Console.ForegroundColor = ConsoleColor.Red;
                else if (level == LOG_LEVEL.INFO)
                    Console.ForegroundColor = ConsoleColor.Yellow;
                else
                    Console.ForegroundColor = ConsoleColor.White;

                if (Console.CursorLeft != 0)
                    Console.WriteLine();
                Console.WriteLine(string.Format("{0,-9}| {1,-6}| {2,-20}| {3}",
                                DateTime.Now.ToString("hh:mm:ss"), level, LOG_TAG, message));
                
                Console.ForegroundColor = ConsoleColor.White;
            }
#endif
        }

        protected void LOG(string function, string message, LOG_LEVEL level)
        {
            message = string.Format("{0,-20}| {1}", function, message);
            Logger.Instance.append(LOG_TAG, message, level);
#if DEBUG
            LOG_LEVEL baseLevel = LOG_LEVEL.OFF;
            if (level > baseLevel)
            {
                if (level == LOG_LEVEL.ERROR)
                    Console.ForegroundColor = ConsoleColor.Red;
                else if (level == LOG_LEVEL.INFO)
                    Console.ForegroundColor = ConsoleColor.Yellow;
                else
                    Console.ForegroundColor = ConsoleColor.White;
                if (Console.CursorLeft != 0)
                    Console.WriteLine();
                Console.WriteLine(string.Format("{0,-9}| {1,-6}| {2,-20}| {3}",
                                    DateTime.Now.ToString("hh:mm:ss"), level, LOG_TAG, message));
                Console.ForegroundColor = ConsoleColor.White;
            }
#endif
        }

        protected void LogException(Exception ex)
        {
            string message = "Exception:\n" + ex.Message + "\nStack trace: " + ex.StackTrace;
            LOG(message, LOG_LEVEL.ERROR);
#if DEBUG
                Console.ForegroundColor = ConsoleColor.Red;
                if (Console.CursorLeft != 0)
                    Console.WriteLine();
                Console.WriteLine(DateTime.Now.ToString("hh:mm:ss") +
                        " | " + "ERROR" +
                        " | " + LOG_TAG +
                        " | " + message);
            Console.ForegroundColor = ConsoleColor.White;
#endif
        }
    }
    */
}
